using NUnit.Framework;
using ValidationFramework.Configuration;
using ValidationFramework.Extensions;

namespace ValidationFramework.Tests.Configuration
{
    [TestFixture]
    public class ComparePropertyRuleConfigReaderTest
    {

        #region Methods

        [Test]
        public void ReadConfig()
        {
            const string validatorXml = "<rule errorMessage='hello' typeName='ComparePropertyRule' ruleSet='foo' propertyToCompare='a' compareOperator='Equal'/>";
            var ruleData = (RuleData.Read(validatorXml.ToXmlReader()));
            var rule = (ComparePropertyRule)ConfigurationService.GetRule(ruleData, typeof(string).TypeHandle);
            Assert.AreEqual("hello", rule.ErrorMessage);
            Assert.AreEqual("a", rule.PropertyToCompare);
            Assert.AreEqual(CompareOperator.Equal, rule.CompareOperator);

        }

        #endregion


    }
}